{% extends 'framework/../framework/layout.html' %}
{% load staticfiles %}
{% block content %}
    <script src="{% static "js/jquery.min.js" %}"></script>
    {% for article in article_list %}
        <div style="text-align:center">
            <h1 class="entry_title">
                <a href="{{ article.get_abstruct_url }}">{{ article.title }}</a>
            </h1>

            <h4 class="text-center">作者：{{ article.author }} &nbsp;<i class="fas fa-eye" style="color: lightskyblue;"></i>阅读数：{{ article.counter }}</h4>
    <span>
        <i class="fas fa-eye" style="color: lightskyblue;"></i>
        {{ article.counter }}
    </span>
            {% if article.author == user %}
                <form action="{% url 'article:delete_article' article.pk %}" method="post">
                    {% csrf_token %}
                    {#            <a href="{% url 'article:delete_article' article.pk %}" class="btn btn-danger">删除文章</a>#}
                    <button class="btn btn-sm btn-danger" type="submit">删除文章</button>
                </form>
                <a href="{% url 'article:edit_article' article.pk %}" class="btn btn-sm btn-primary">编辑文章</a>
            {% endif %}

        </div>
        <div class="col-md-8 col-md-offset-2">
            <p>{{ article.body|safe }}</p>
        </div>
        <div>
            {{ toc|safe }}
        </div>

<!-- 页码导航 -->
<div class="pagination row">
    <div class="m-auto">
        <span class="step-links">
            <!-- 如果不是第一页，则显示上翻按钮 -->
            {% if article.has_previous %}
                <a href="?page=1" class="btn btn-success">
                    &laquo; 1
                </a>
                <span>...</span>
                <a href="?page={{ article.previous_page_number }}"
                   class="btn btn-secondary"
                >
                    {{ article.previous_page_number }}
                </a>
            {% endif %}

            <!-- 当前页面 -->
            <span class="current btn btn-danger btn-lg">
                {{ article.number }}
            </span>

            <!-- 如果不是最末页，则显示下翻按钮 -->
            {% if article.has_next %}
                <a href="?page={{ article.next_page_number }}"
                   class="btn btn-secondary"
                >
                    {{ article.next_page_number }}
                </a>
                <span>...</span>
                <a href="?page={{ article.paginator.num_pages }}"
                   class="btn btn-success"
                >
                    {{ article.paginator.num_pages }} &raquo;
                </a>
            {% endif %}
        </span>
    </div>
</div>

    {% endfor %}








{% endblock %}